#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/6/15 22:24
# @Author  : Lewic
# @File    : script1.py
# @Software: PyCharm
# @context : 


from models.features import FeatureClass

class Script1Class(FeatureClass):
    script_name = 'script1'

    def __init__(self, master):
        super().__init__(master)
        self.create_panel1()

    def create_panel1(self):
        self.input_params = {'A': '', 'B': '', 'C': ''}
        self.components = [
            {'type': 'label', 'text': self.script_name},
            {'type': 'entry', 'name': 'A', 'label_name': 'input A'},
            {'type': 'entry', 'name': 'B'},
            {'type': 'combobox', 'values': ['Option 1', 'Option 2', 'Option 3'], 'name': 'C'}
        ]
        self.buttons = [
            {'label': 'Confirm', 'command': self.run_feature},
            {'label': 'Clear Inputs', 'command': self.clear_inputs}
        ]

    def run_feature(self):
        input_A = self.get_input_param('A').get()
        input_B = self.get_input_param('B').get()
        selection_C = self.get_input_param('C').get()
        for i in range(100):
            self.log(str(i))
        self.log(f"Input A: {input_A}, Input B: {input_B}, Selection C: {selection_C}")

    def confirm_action(self):
        self.run_feature()
        # 实现具体的确认动作逻辑，这里简单返回 True
        return True
